package org.itheimma.springbootquickstart.controller;

import org.itheimma.springbootquickstart.pojo.Images;
import org.itheimma.springbootquickstart.pojo.Result;
import org.itheimma.springbootquickstart.service.ipml.ImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/img")
public class ImgController {
    @Autowired
    private ImgService imgService;
    @GetMapping("/upload")
    public Result upload(int three_id,String image_url,String uploaded_by){
        //插入图片
        imgService.upload(three_id,image_url,uploaded_by);
        return Result.success();
        //查询图片id
//        Images i = imgService.findByImgId(image_id);
//        if (i==null){
//            //没有占用
//            //上传
//            imgService.upload(three_id,image_url,uploaded_by);
//            return Result.success();
//        }else {
//            //占用
//            return Result.error("用户被占用");
//        }
    }
}
